package com.ericsson.rm.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;

/**
 * The persistent class for the PROJECT_RESOURCE_DETAIL database table.
 * 
 */
@Entity
//@NamedQueries({ 
//@NamedQuery(name = "ProjectResourceDetail.findProjectResourceId", query = "SELECT p.projectId,p.resourceid FROM ProjectResourceDetail " +
	//	"p WHERE p.allocationStartDate>=:startDate AND p.allocationEndDate<=endDate") })

@NamedQueries({
	/*@NamedQuery(name = "ProjectResourceDetail.getdetails",
			    query = "select new com.ericsson.rm.vo.ProjectResourceDetailVO(pr.resourceDetail.resourceId, "
			    		+ "pr.projectDetail.projectId,pr.projectResourceId, pr.allocationStartDate, "
			    		+ "pr.allocationEndDate,pr.allocationPercentage) from ProjectResourceDetail pr "
			    		+ "where pr.projectDetail.projectId=:projId")*/
	
	/*@NamedQuery(name = "ProjectResourceDetail.getdetails",
				query = "select pr.resourceDetail.resourceId,pr.projectDetail.projectId,pr.projectResourceId, "
						+ "pr.allocationStartDate, pr.allocationEndDate,pr.allocationPercentagefrom ProjectResourceDetail pr "
			    		+ "where pr.projectDetail.projectId=:projId")*/
	
	@NamedQuery(name = "ProjectResourceDetail.getdetailsbyProjId",
			    query = "select pr from ProjectResourceDetail pr where pr.projectDetail.projectId=:projId")
	
})

@Table(name = "RP_PROJECT_RESOURCE_DETAIL")
public class ProjectResourceDetail implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "PROJECT_RESOURCE_ID")
	private String projectResourceId;

	@Temporal(TemporalType.DATE)
	@Column(name = "ALLOCATION_END_DATE")
	private Date allocationEndDate;

	@Transient
	//@Column(name = "ALLOCATION_ID") //added @Transient and commented this line
	private String allocationId;

	@Column(name = "ALLOCATION_PERCENTAGE")
	private String allocationPercentage;

	@Temporal(TemporalType.DATE)
	@Column(name = "ALLOCATION_START_DATE")
	private Date allocationStartDate;

	@Transient
	//@Column(name = "\"ROLE\"") //added @Transient and commented this line
	private String role;

	@Transient
	private String status;

	// bi-directional many-to-one association to ProjectDetail
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PROJECT_ID")
	private ProjectDetail projectDetail;

	// bi-directional many-to-one association to ResourceDetail
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RESOURCE_ID")
	private ResourceDetail resourceDetail;

	public ProjectResourceDetail() {
	}

	public String getProjectResourceId() {
		return this.projectResourceId;
	}

	public void setProjectResourceId(String projectResourceId) {
		this.projectResourceId = projectResourceId;
	}

	public Date getAllocationEndDate() {
		return this.allocationEndDate;
	}

	public void setAllocationEndDate(Date allocationEndDate) {
		this.allocationEndDate = allocationEndDate;
	}

	public String getAllocationId() {
		return this.allocationId;
	}

	public void setAllocationId(String allocationId) {
		this.allocationId = allocationId;
	}

	public String getAllocationPercentage() {
		return this.allocationPercentage;
	}

	public void setAllocationPercentage(String allocationPercentage) {
		this.allocationPercentage = allocationPercentage;
	}

	public Date getAllocationStartDate() {
		return this.allocationStartDate;
	}

	public void setAllocationStartDate(Date allocationStartDate) {
		this.allocationStartDate = allocationStartDate;
	}

	public String getRole() {
		return this.role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public ProjectDetail getProjectDetail() {
		return this.projectDetail;
	}

	public void setProjectDetail(ProjectDetail projectDetail) {
		this.projectDetail = projectDetail;
	}

	public ResourceDetail getResourceDetail() {
		return this.resourceDetail;
	}

	public void setResourceDetail(ResourceDetail resourceDetail) {
		this.resourceDetail = resourceDetail;
	}

}